package br.edu.utfpr.servidor.rmi;

import br.edu.utfpr.comum.*;
import br.edu.utfpr.servidor.util.ZipUtil;
import br.edu.utfpr.servidor.util.facade_.Arquivo;
import br.edu.utfpr.servidor.util.facade_.FacadeArquivo;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class RmiProviderImpl extends UnicastRemoteObject implements RmiProvider{

    private static final long serialVersionUID = 1L;
    private FacadeArquivo facade;
	
	protected RmiProviderImpl() throws RemoteException {
		super();
        facade = new Arquivo();
	}

	@Override
	public RetornoValidacao gerarBackup(Stream stream,BackupDTO dto) throws RemoteException {
        return facade.gravarArquivo(stream, dto);
	}

    @Override
    public RetornoValidacao gerarRestore(BackupDTO dto) throws RemoteException {
        return facade.geraRestore(dto);
    }


    @Override
    public boolean possuiBackup(BackupDTO dto) throws RemoteException {
          return new ZipUtil().possuiBackup(dto);
    }


}
